package com.es.system;

import java.util.ArrayList;
import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;

import com.es.main.HrmMenu;
import com.es.main.LoginBiz;
import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.xwork.ActionSupport;

public class GetMenuListByRoleAction extends ActionSupport implements ServletRequestAware{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	HttpServletRequest request;
	 
	   public String execute()throws Exception
	   {
		   String roleId = request.getParameter("roleId");
		   String message = (String)request.getAttribute("message");
		   LoginBiz biz = new LoginBiz();
		   SysBiz biz1 = new SysBiz();
		   ArrayList<HrmMenu> menuList = biz.getEmpMenu(roleId);
		   ArrayList<HashMap<String,String>>  roleList = biz1.getRoleList();
		   ArrayList<HrmMenu> menuAllList = biz1.getMenuAllList();
		   request.setAttribute("roleList", roleList);
		   request.setAttribute("menuList", menuList);
		   request.setAttribute("menuAllList", menuAllList);
		   request.setAttribute("roleId", roleId);
		   if(message!=null)
			   request.setAttribute("message", message);
		   return "success";
	   }
	
	   public void setServletRequest(HttpServletRequest request) {
		     this.request = request;
		   }
}
